//
//  LWHScrollVC.m
//  UI_SectionA
//
//  Created by dllo on 15/11/9.
//  Copyright © 2015年 liwenhan. All rights reserved.
//

#import "LWHScrollVC.h"
#import "AppDelegate.h"
#import "LCZNewsViewController.h"
#import "DEMOLeftMenuViewController.h"
#import "RESideMenu.h"


#define WIDTH self.view.frame.size.width
#define HEIGHT self.view.frame.size.height

@interface LWHScrollVC ()<UIScrollViewDelegate>

@property (nonatomic, strong)UIScrollView *scrollView;

@end

@implementation LWHScrollVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor cyanColor];
    NSArray *arr = [NSArray arrayWithObjects:@"11.png",@"22.png", @"33.png", nil];
    self.scrollView = [[UIScrollView alloc]init];
    self.scrollView.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
    self.scrollView.contentSize = CGSizeMake(WIDTH * 3, HEIGHT);
    self.scrollView.delegate = self;
    self.scrollView.pagingEnabled = YES;
    self.scrollView.showsHorizontalScrollIndicator = NO;
    
    for (int i = 0; i < 3; i++)
    {
        UIImageView * imageView = [[UIImageView alloc]init];
        imageView.frame = CGRectMake(WIDTH * i, 0, WIDTH, HEIGHT);
        imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",arr[i]]];
        [self.scrollView addSubview:imageView];
    }
    [self.view addSubview:self.scrollView];

    
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    CGFloat offsetX = scrollView.contentOffset.x;
    if (offsetX > WIDTH * 2) {
        NSLog(@"走完了");
        
//        LCZNewsViewController *aaVC = [[LCZNewsViewController alloc]init];
        
        RESideMenu *aaVC = [[RESideMenu alloc]init];
        [[UIApplication sharedApplication].keyWindow setRootViewController:aaVC];
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
